<template>
  <div class="order-ycspace-list-view">
    <ComplexTable :columns="columns" :list="tableList" :selection="true">
      <div class="slot-wrapper">
        <div class="operation-btn">
          <el-button type="primary" size="small">空间主批量回购</el-button>
          <el-button type="success" size="small">公司批量回购</el-button>
          <el-button type="info" size="small">批量关闭</el-button>
          <el-button type="info" size="small">批量撤销</el-button>
          <el-button type="info" size="small">批量退款并关闭</el-button>
        </div>
      </div>
    </ComplexTable>
  </div>
</template>

<script>
import ComplexTable from '@/components/ComplexTable'

export default {
  name: 'SpaceOrderList',
  components: { ComplexTable },

  data() {
    return {
      tableList: [
        {
          id: '201683',
          author: '宽心应是酒，遣兴莫过诗',
          price: '¥2000.00',
          status: '未售出',
          code: 132223111222311232,
          time: '2017-07-19 14:48:38',
          down: '15:00',
          sale: '张三  13099090999  详细',
          buy: '李四 18000000000 详细',
          space: '赜隐',
          goodstatus: '待付款',
          call: '是（待处理） 查看'
        }
      ]
    }
  },

  computed: {
    columns() {
      return [
        {
          label: '商品ID',
          prop: 'id',
          fixed: 'left',
          search: 'input'
        },
        {
          label: '商品名称',
          prop: 'author'
        },
        {
          label: '当前售价',
          prop: 'price'
        },
        {
          label: '商品销售状态',
          prop: 'status',
          search: 'select',
          options: [
            {
              label: '张三',
              value: '1'
            },
            {
              label: '李四',
              value: '2'
            }
          ]
        },
        {
          label: '订单编号',
          prop: 'code',
          search: 'input'
        },
        {
          label: '下单时间',
          prop: 'time',
          search: 'date'
        },
        {
          label: '付款倒计时',
          prop: 'down'
        },
        {
          label: '销方',
          prop: 'sale'
        },
        {
          label: '买方',
          prop: 'buy',
          search: 'input'
        },
        {
          label: '买方账号',
          prop: 'buyphone',
          search: 'input',
          hideInTable: true
        },
        {
          label: '价格区间',
          prop: 'pricelabel',
          hideInTable: true,
          search: 'select',
          options: [
            {
              label: '张三',
              value: '1'
            },
            {
              label: '李四',
              value: '2'
            }
          ]
        },
        {
          label: '买方所属空间',
          prop: 'space',
          search: 'select',
          options: [
            {
              label: '张三',
              value: '1'
            },
            {
              label: '李四',
              value: '2'
            }
          ]
        },
        {
          label: '订单状态',
          prop: 'goodstatus',
          search: 'select',
          options: [
            {
              label: '张三',
              value: '1'
            },
            {
              label: '李四',
              value: '2'
            }
          ]
        },
        {
          label: '是否申诉',
          prop: 'call',
          search: 'select',
          options: [
            {
              label: '张三',
              value: '1'
            },
            {
              label: '李四',
              value: '2'
            }
          ]
        },
        {
          label: '操作',
          prop: 'operate',
          align: 'center',
          width: '500',
          fixed: 'right',
          render: (h, data) => {
            return (
              <div>
                <el-button
                  size="mini"
                  onClick={() => {
                    this.$router.push({ name: 'SpaceOrderDetail' })
                  }}
                >
                  查看
                </el-button>
                <el-button size="mini">手动上架</el-button>
                <el-button size="mini">关闭订单</el-button>
                <el-button size="mini">撤销订单</el-button>
                <el-button size="mini">空间主回购</el-button>
                <el-button size="mini">公司回购</el-button>
              </div>
            )
          }
        }
      ]
    }
  },

  beforeMount() {
    // console.log('asd')
  },

  methods: {
    test(data) {
      console.log('data')

      console.log(data)
    }
  }
}
</script>

<style lang="scss">
@import './index';
</style>
